﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LikeUs.WebService.Client.WSInfoClient;
using System.Data;

namespace LikeUs.WebService.Client
{
    public class WSInfoProxy
    {
        private WSInfoClient.WSInfoClient m_wsClient;

        public WSInfoProxy()
        {
            //m_wsClient = new WSInfoClient.WSInfoClient("BasicHttpBinding_IWSInfo");
            m_wsClient = new WSInfoClient.WSInfoClient();
        }

/*        public MovieInfo GetMovieInfo(int userId)
        {
            MovieInfo movieInfo = m_wsClient.GetMovieInfo(10);
            return movieInfo;
        }*/
        /// <summary>
        /// 
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public DataTable GetAllMyFriends(int userid)
        {
            return m_wsClient.GetAllMyFriends(userid);
        }

        public DataTable getMoviesLearning(int userid, int limit)
        {
            return m_wsClient.getMoviesLearning(userid,limit);
        }

        public void linkUserMovie(int userid, int movieid, float rating)
        {
            m_wsClient.linkUserMovie(userid, movieid, rating);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="data"></param>
        public int CreateUser(UserData data)
        {
            return m_wsClient.CreateUser(data);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public UserData GetUser(int userid, object additions)
        {
            return m_wsClient.GetUser(userid,additions);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="data"></param>
        public void UpdateUserData(UserData data)
        {
            m_wsClient.UpdateUserData(data);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        public void DeleteUserAccount(int id)
        {
            m_wsClient.DeleteUserAccount(id);
        }

        public int ValidateUserAccount(string username, string password)
        {
            return m_wsClient.ValidateUserAccount(username,password,null);
        }

        public int ValidateAndCreateFBUserAccount(string accesstoken,int requestedDistance)
        {
            int userid = -1;
            userid = m_wsClient.ValidateUserAccount(null, null, accesstoken);
            if (userid == -1)
                userid=m_wsClient.CreateFBUser(accesstoken, requestedDistance);
            return userid;
        }

        public void userRelationsRoutine(UserData userData)
        {
            m_wsClient.userRelationsRoutine(userData);
        }


        public DataTable myRatings(int userid)
        {
            return m_wsClient.myRatings(userid);
        }

        public DataTable friendRatings(int friendid, int myid)
        {
            return m_wsClient.friendRatings(friendid, myid);
        }

        public DataTable GetTopGroupMovies(int userid,int nlimit)
        {
            return m_wsClient.GetTopGroupMovies(userid,nlimit);
        }

        public string[] getLog(int userid, int nlimit)
        {
            return m_wsClient.getLog(userid, nlimit);
        }

        public void log(int userid, string log)
        {
            m_wsClient.log(userid, log);
        }
    }
}
